<template>
  <!-- 金融服务 -->
  <div class="financial">
    <div class="header">
      <p class="title">金融服务板块</p>
    </div>
    <div class="display">
      <div class="item">
        <span class="icon icon1"></span>
        <p class="data">
          <span class="key">{{ amount.name || "融资金额" }}</span>
          <count-to
            class="val"
            :startVal="0"
            :endVal="amount.value"
            :duration="1000"
            :decimals="2"
          ></count-to>
          <span class="unit">{{ amount.unit }}</span>
        </p>
      </div>
      <div class="item">
        <span class="icon icon2"></span>
        <p class="data">
          <span class="key">{{ credit.name || "授信金额" }}</span>
          <count-to
            class="val"
            :startVal="0"
            :endVal="credit.value"
            :duration="1000"
            :decimals="2"
          ></count-to>
          <span class="unit">{{ credit.unit }}</span>
        </p>
      </div>
      <div class="item">
        <span class="icon icon3"></span>
        <p class="data">
          <span class="key">{{ compCount.name || "授信金额" }}</span>
          <count-to
            class="val"
            :startVal="0"
            :endVal="compCount.value"
            :duration="1000"
          ></count-to>
          <span class="unit">{{ compCount.unit }}</span>
        </p>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import CountTo from "@/components/vueCountTo/vue-countTo.vue";
import { ajax } from "@/store/service";

const amount = ref({});
const credit = ref({});
const compCount = ref({});

const init = async () => {
  const [res] = await ajax.fund();
  amount.value=res.amount
  credit.value=res.credit
  compCount.value=res.compCount

};
onMounted(() => {
  init();
});
</script>

<style scoped lang='scss'>
.financial {
  width: 548px;
  height: 426px;
  margin-bottom: 37px;
  .header {
    width: 100%;
    height: 80px;
    background: url("@/assets/longscreen2/title-short.png");
    box-sizing: border-box;
    padding-top: 15px;
    margin-bottom: 2px;
    .title {
      font-size: 22px;
      font-family: JLinXin;
      font-weight: 600;
      line-height: 22px;
      background: #fffde8 linear-gradient(180deg, #e8feff 40%, #00a9ff 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      font-weight: bold;
      margin-left: 68px;
    }
  }
  .display {
    width: 482px;
    height: 344px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .item {
      height: 102px;
      display: flex;
      align-items: center;
      background: url("@/assets/longscreen2/背景.svg");
      background-size: 100% 100%;
      background-repeat: no-repeat;
      .icon {
        display: block;
        width: 60px;
        height: 60px;

        margin-left: 37px;
      }
      .icon1 {
        background: url("@/assets/longscreen2/icon_rongzijine.png");
      }
      .icon2 {
        background: url("@/assets/longscreen2/icon_shouxinjine.png");
      }
      .icon3 {
        background: url("@/assets/longscreen2/icon_shouxinqiye.png");
      }
      .data {
        margin-left: 13px;
        .key {
          font-size: 18px;
          font-family: SourceHanSansCN-Medium, SourceHanSansCN;
          font-weight: 500;
          color: #ffffff;
          line-height: 27px;
        }
        .val {
          font-size: 32px;
          font-family: D-DIN-PRO-Heavy, D-DIN-PRO;
          font-weight: 800;
          color: #ffffff;
          line-height: 28px;
          letter-spacing: 1px;
          margin-left: 10px;
        }
        .unit {
          font-size: 18px;
          font-family: SourceHanSansCN-Medium, SourceHanSansCN;
          font-weight: 500;
          color: #ffffff;
          line-height: 27px;
          opacity: 0.36;
          margin-left: 14px;
        }
      }
    }
  }
}
</style>